//
//  NDTabButton.swift
//  NyamanDana
//
//  Created by 李永彬 on 2025/10/7.
//

import SwiftUI

struct NDTabButton: View {
    let item: NDTabItem
    let isSelected: Bool
    let action: () -> Void
    
    var body: some View {
        Button(action: action) {
            
            VStack(alignment: .center) {
                if let normalIcon = item.normalIcon {
                    Image(isSelected ? (item.selectedIcon ?? "") : normalIcon)
                }
                
                if let title = item.title {
                    Text(title)
                        .font(.system(size: 15, weight: .bold))
                        .foregroundColor(isSelected ? item.color : Color(hex: "#848484"))
                }
            }
            .frame(maxWidth: .infinity,
                   maxHeight: .infinity,
                   alignment: .center)
            .background(Color.clear)
        }
    }
}
